package com.ibuonline.search.solr.extend;

import java.util.Map;

public abstract class AbstractExternalDataHandler<T> implements DocumentHander {
	@Override
	public boolean add(SolrIndexContext context) {
		saveExternalData(toModel(context.getModel()));
		return true;
	}

	@Override
	public boolean delete(Object id) {
		deleteExternalData(id);
		return true;
	}

	protected abstract T toModel(Map<String, Object> props);

	protected abstract void saveExternalData(T t);

	protected abstract void deleteExternalData(Object id);

}
